package com.bh.shipment.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bh.common.utils.DateUtils;
import com.bh.shipment.domain.JcShipmentImg;
import com.bh.shipment.mapper.JcShipmentImgMapper;
import com.bh.shipment.service.IJcShipmentImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 运单装车图片Service业务层处理
 * 
 * @author slx
 * @date 2023-05-24
 */
@Service
public class JcShipmentImgServiceImpl extends ServiceImpl<JcShipmentImgMapper, JcShipmentImg> implements IJcShipmentImgService
{
    @Autowired
    private JcShipmentImgMapper jcShipmentImgMapper;

    /**
     * 查询运单装车图片
     * 
     * @param id 运单装车图片主键
     * @return 运单装车图片
     */
    @Override
    public JcShipmentImg selectJcShipmentImgById(Long id)
    {
        return jcShipmentImgMapper.selectById(id);
    }

    /**
     * 查询运单装车图片
     *
     * @param id 运单装车图片主键
     * @return 运单装车图片
     */
    @Override
    public List<JcShipmentImg> selectJcShipmentImgByShipmentId(Long jcShipmentId)
    {
        return jcShipmentImgMapper.selectJcShipmentImgByShipmentId(jcShipmentId);
    }

    /**
     * 查询运单装车图片列表
     * 
     * @param jcShipmentImg 运单装车图片
     * @return 运单装车图片
     */
    @Override
    public List<JcShipmentImg> selectJcShipmentImgList(JcShipmentImg jcShipmentImg)
    {
        return jcShipmentImgMapper.selectJcShipmentImgList(jcShipmentImg);
    }

    /**
     * 新增运单装车图片
     * 
     * @param jcShipmentImg 运单装车图片
     * @return 结果
     */
    @Override
    public int insertJcShipmentImg(JcShipmentImg jcShipmentImg)
    {
        jcShipmentImg.setCreateTime(DateUtils.getNowDate());
        return jcShipmentImgMapper.insert(jcShipmentImg);
    }

    /**
     * 批量删除运单装车图片
     * 
     * @param ids 需要删除的运单装车图片主键
     * @return 结果
     */
    @Override
    public int deleteJcShipmentImgByIds(Long[] ids)
    {
        return jcShipmentImgMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除运单装车图片信息
     * 
     * @param id 运单装车图片主键
     * @return 结果
     */
    @Override
    public int deleteJcShipmentImgById(Long id)
    {
        return jcShipmentImgMapper.deleteById(id);
    }
}
